package com.eephone.ep.tools;

import android.app.ProgressDialog;
import android.content.Context;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

/**
 * Created by Xu on 2015/12/15.
 */
public class MessageTools {

    public static Snackbar makeShortSnack(View view, String message) {
        Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_SHORT);
        TextView textView = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
        textView.setTextColor(ContextCompat.getColor(view.getContext(), android.R.color.white));
        return snackbar;
    }

    public static Snackbar makeLongSnack(View view, String message) {
        Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
        TextView textView = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
        textView.setTextColor(ContextCompat.getColor(view.getContext(), android.R.color.white));
        return snackbar;
    }

    public static Toast makeShortToast(Context context, String message) {
        return Toast.makeText(context, message, Toast.LENGTH_SHORT);
    }

    public static Toast makeLongToast(Context context, String message) {
        return Toast.makeText(context, message, Toast.LENGTH_LONG);
    }

    public static ProgressDialog makeProgressDialog(Context context, String title, String message) {
        return ProgressDialog.show(context, title, message);
    }

}
